<template>
    <div class="accounting">
        <div class="tabs-top">
            <nuxt-link
                v-for="(item, index) in tabsList"
                :class="{ 'tabs-active': tabsIndex == index }"
                :key="index"
                class="tab"
                :to="`/kjfgk/${item.pathName}/0/1`"
            >
                {{ item.name }}
            </nuxt-link>
        </div>

        <div
            class="big-search"
            :style="{ backgroundImage: 'url(' + searchBj + ')' }"
        >
            <div class="big-search-div" @keydown="keydown">
                <el-dropdown
                    szie="medium"
                    placement="bottom-start"
                    @command="command"
                >
                    <div class="left">
                        {{ retrieveFields == "name" ? "查标题" : "" }}
                        {{
                            retrieveFields == "info_content_text"
                                ? "查文章"
                                : ""
                        }}
                        {{ retrieveFields == "push_number" ? "查文号" : "" }}
                        {{ retrieveFields == "push_date" ? "查时间" : "" }}
                        <i class="el-icon-arrow-down el-icon--right"></i>
                    </div>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="name">
                            <span
                                :style="{
                                    color:
                                        retrieveFields == 'name'
                                            ? '#004895'
                                            : '#333333',
                                }"
                            >
                                查标题
                            </span>
                        </el-dropdown-item>
                        <el-dropdown-item command="info_content_text">
                            <span
                                :style="{
                                    color:
                                        retrieveFields == 'info_content_text'
                                            ? '#004895'
                                            : '#333333',
                                }"
                            >
                                查文章
                            </span>
                        </el-dropdown-item>
                        <el-dropdown-item command="push_number">
                            <span
                                :style="{
                                    color:
                                        retrieveFields == 'push_number'
                                            ? '#004895'
                                            : '#333333',
                                }"
                            >
                                查文号
                            </span>
                        </el-dropdown-item>
                        <el-dropdown-item command="push_date">
                            <span
                                :style="{
                                    color:
                                        retrieveFields == 'push_date'
                                            ? '#004895'
                                            : '#333333',
                                }"
                            >
                                查时间
                            </span>
                        </el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                <el-input
                    v-if="
                        retrieveFields == 'name' ||
                        retrieveFields == 'info_content_text'
                    "
                    v-model="searchInput"
                    class="search-input"
                    placeholder="请输入内容"
                    maxlength="60"
                ></el-input>

                <template v-if="retrieveFields == 'push_number'">
                    <el-input
                        v-model="searchInput"
                        class="search-input"
                        placeholder="国家税务总局公告"
                        maxlength="60"
                    ></el-input>
                    <!-- <span class="kuohao">〔</span>
                    <el-input
                        class="search-input"
                        style="width: 100px"
                        v-model="number2"
                        placeholder="2023"
                    ></el-input>
                    <span class="kuohao">〕</span>
                    年
                    <el-input
                        class="search-input"
                        style="width: 80px"
                        v-model="number3"
                        placeholder="1"
                    ></el-input>
                    号
                    <span style="padding: 0 20px"></span> -->
                </template>

                <template v-if="retrieveFields == 'push_date'">
                    <el-date-picker
                        v-model="date"
                        class="search-input"
                        type="daterange"
                        range-separator="至"
                        value-format="yyyy-MM-dd"
                        format="yyyy-MM-dd"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                        :picker-options="pickerOptions"
                    >
                    </el-date-picker>
                </template>

                <div class="search-button" @click="allSearch">
                    <i class="el-icon-search"></i>
                    搜索
                </div>
            </div>
            <div class="big-search-sbvip" @click="goViponly()">
                会员专享解读
                <div>会员专享</div>
            </div>
        </div>

        <div v-if="tabsIndex == 0" class="index">
            <div class="left">
                <div class="introduce introduce-index">
                    <introduceModule
                        :type="1"
                        :introduce="introduce"
                    ></introduceModule>
                </div>

                <div class="wx-code">
                    <img
                        src="https://xzcs-video.oss-cn-beijing.aliyuncs.com/pc/fgk_wx_code.png"
                        alt="小竹财税APP"
                    />
                </div>

                <div class="link">
                    <div class="new-tabs">
                        <div class="title">国内导航</div>
                        <div class="new-switch">
                            <div
                                v-for="(item, index) in linkList"
                                :key="index"
                                class="new-tab"
                                :class="{
                                    'new-tab-active': linkIndex == index,
                                }"
                                @click="linkIndex = index"
                            >
                                {{ item.name }}
                            </div>
                        </div>
                    </div>

                    <div v-if="linkIndex == 0" class="list">
                        <a
                            v-for="(item, index) in chinatax"
                            :key="index"
                            class="item"
                            :href="item.link"
                            target="_blank"
                            rel="nofollow"
                        >
                            {{ item.region }}
                        </a>
                    </div>
                    <div v-else class="list padding-l30">
                        <a
                            v-for="(item, index) in customs"
                            :key="index"
                            class="item2"
                            :href="item.link"
                            target="_blank"
                            rel="nofollow"
                        >
                            {{ item.region }}
                        </a>
                    </div>
                </div>
                <!-- 热门阅读 -->
                <hotRead
                    :hotReadList="hotReadList"
                    titleKey="name"
                    toType="kjfgk"
                />
            </div>
            <div class="right">
                <div class="right_top">
                    <div class="title">
                        <el-image
                            class="icon"
                            :src="hotIcon"
                            fit="cover"
                        ></el-image>
                        全科目核算
                    </div>

                    <div class="list">
                        <div
                            v-for="(item, index) in dataList"
                            :key="index"
                            class="item"
                        >
                            <nuxt-link
                                v-if="item.name"
                                class="name"
                                target="_blank"
                                :to="`/kjfgk/${item.id}.html`"
                            >
                                {{ item.name }}
                            </nuxt-link>
                            <div
                                v-html="getText(item.info_content, 90)"
                                class="introduce_txt"
                            ></div>
                            <div class="date">{{ item.push_date }}</div>
                        </div>
                    </div>

                    <div class="pagination">
                        <el-pagination
                            background
                            layout="prev, pager, next, jumper"
                            :total="total"
                            :page-size="pageSize"
                            @current-change="changePage"
                        >
                        </el-pagination>
                    </div>
                </div>
                <div class="right_bottom hot_read">
                    <recommendedReading
                        :readingList="readingList"
                        titleKey="name"
                        textKey="info_content"
                        toType="kjfgk"
                    >
                    </recommendedReading>
                </div>
            </div>
        </div>
        <div v-show="tabsIndex != 0" class="regulation">
            <breadcrumb>
                <el-breadcrumb separator-class="el-icon-arrow-right">
                    <el-breadcrumb-item>
                        <nuxt-link class="breadcrumb-item" to="/"
                            >首页</nuxt-link
                        >
                    </el-breadcrumb-item>
                    <el-breadcrumb-item>
                        <nuxt-link
                            class="breadcrumb-item"
                            to="/kjfgk/index/0/1"
                        >
                            会计法规库
                        </nuxt-link>
                    </el-breadcrumb-item>
                    <el-breadcrumb-item>{{
                        tabsList.length > 1 ? tabsList[tabsIndex].name : ""
                    }}</el-breadcrumb-item>
                </el-breadcrumb>
            </breadcrumb>

            <div class="regulation-con">
                <div class="left">
                    <div class="introduce1">
                        <introduceModule
                            :type="2"
                            :introduce="introduce1"
                        ></introduceModule>
                    </div>
                    <div class="wx-code2">
                        <img
                            src="https://xzcs-video.oss-cn-beijing.aliyuncs.com/pc/fgk_wx_code.png"
                            alt="小竹财税APP"
                        />
                    </div>
                    <div class="left_bottom">
                        <el-menu
                            :default-active="tabsIndex + '' + tabsTwoIndex"
                            unique-opened
                            class="el-menu-vertical-demo"
                            @select="menuSelect"
                        >
                            <template v-for="(items, indexs) in tabsList">
                                <template v-if="indexs != 0">
                                    <el-submenu
                                        v-show="tabsIndex == indexs"
                                        :key="indexs"
                                        :index="indexs + ''"
                                    >
                                        <template slot="title">
                                            <span>{{ items.name }}</span>
                                        </template>
                                        <el-menu-item
                                            v-for="(item, index) in items.class"
                                            :key="item.id"
                                            :index="indexs + '' + index"
                                        >
                                            {{ item.name }}
                                        </el-menu-item>
                                    </el-submenu>
                                </template>
                            </template>
                        </el-menu>
                    </div>
                </div>

                <div class="right">
                    <div class="right_top">
                        <!-- 搜索 -->

                        <!-- 搜索 end -->

                        <div v-show="!isSearch" class="r-title">
                            {{
                                tabsList[tabsIndex].class.length > 0
                                    ? tabsList[tabsIndex].class[tabsTwoIndex]
                                          .name
                                    : ""
                            }}
                            <div></div>
                        </div>
                        <div v-loading="loading" class="r-list">
                            <div v-for="(item, index) in dataList" :key="index">
                                <statute
                                    :item="item"
                                    :pathUrl="`/kjfgk/${item.id}.html`"
                                ></statute>
                            </div>
                            <el-empty
                                v-show="dataList.length == 0"
                                description="暂无数据"
                            ></el-empty>
                        </div>
                        <div class="pagination">
                            <el-pagination
                                background
                                layout="prev, pager, next, jumper"
                                :current-page="page"
                                :total="total"
                                :page-size="pageSize"
                                @current-change="changePage"
                            >
                            </el-pagination>
                        </div>
                    </div>

                    <!-- 推荐阅读 -->
                    <div class="right_bottom hot_read">
                        <recommendedReading
                            :readingList="readingList"
                            titleKey="name"
                            textKey="info_content"
                            toType="kjfgk"
                        ></recommendedReading>
                    </div>
                </div>
            </div>
        </div>

        <!-- 浮动弹窗 -->
        <no-ssr>
            <!-- <dynamicPopUps></dynamicPopUps> -->
        </no-ssr>
    </div>
</template>

<script>
import { mapMutations, mapState } from "vuex";
import { CICPA, rd } from "@/assets/utils/regulation.js";
import {
    faguislideshow,
    getNormGetList,
    getNormAllclass,
    getNormSearch,
} from "@/assets/api/regulationsApi.js";
import { checkviewNorm, getanalysedata } from "@/assets/api/indexApi.js";
import { recommend_norm } from "@/assets/api/quizData";

import {
    goTop,
    getArr_objKey,
    getText,
    goTopSmooth,
} from "@/assets/utils/utils.js";

import breadcrumb from "@/components/index/breadcrumb.vue";
import statute from "@/components/regulations/statute.vue";

import hotIcon from "@/assets/images/regulations/shouye_header_nav_hot.png";

// 推荐阅读组件
import recommendedReading from "@/components/recommendedReading/index-router.vue";
// 介绍组件
import introduceModule from "@/components/introduce";
// 热门阅读组件
import hotRead from "@/components/hotRead";

// 引入介绍json文件
import introduceJson from "@/assets/json/introduce.json";

import searchBj from "@/assets/images/regulations/TaxRevenue-bj.jpg";

import moment from "moment";
import dynamicPopUps from "@/components/index/dynamicPopUps.vue";
export default {
    async asyncData({ params, query }) {
        let data = {
            tabsIndex: 0,
            tabsTwoIndex: 0,
            tabsList: [
                {
                    name: "首页",
                    id: "86",
                    pathName: "index",
                    code: "PE1",
                    class: [
                        {
                            id: 86,
                        },
                    ],
                },
                {
                    id: 1,
                    name: "企业会计",
                    sort: "99",
                    pathName: "qykj",
                    code: "PE3",
                    class: [],
                },
                {
                    id: 2,
                    name: "证监会",
                    sort: "0",
                    pathName: "zjh",
                    code: "PE4",
                    class: [],
                },
                {
                    id: 3,
                    name: "政府会计",
                    sort: "98",
                    pathName: "zfkj",
                    code: "PE5",
                    class: [],
                },
                {
                    id: 4,
                    name: "国际会计",
                    sort: "0",
                    pathName: "gjkj",
                    code: "PE6",
                    class: [],
                },
                {
                    id: 5,
                    name: "企业内控",
                    sort: "96",
                    pathName: "qynk",
                    code: "PE7",
                    class: [],
                },
                {
                    id: 6,
                    name: "全行业会计核算",
                    sort: "97",
                    pathName: "qhykjhs",
                    code: "PE8",
                    class: [],
                },
                {
                    id: 7,
                    name: "其他会计法规",
                    sort: "0",
                    pathName: "qtkjfg",
                    code: "PE9",
                    class: [],
                },
                {
                    id: 8,
                    name: "全科目核算",
                    sort: "96.5",
                    pathName: "qkmhs",
                    code: "PE10",
                    class: [],
                },
            ],
            dataList: [],
            total: 0,
            pageSize: 30,
            page: 1,
            isSearch: false,
            hotReadList: [], //热门阅读列表
            readingList: [], //推荐阅读列表
            jsonld: {
                "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
                "@id": "https://www.xzcs2022.com/kjfgk/",
                images: [""],
                title: "",
                description: "",
                pubDate: "",
                upDate: "",
            },
        };

        if (query.index) {
            data.tabsIndex = parseInt(query.index);
        }
        if (params.type) {
            data.tabsIndex = getArr_objKey(
                data.tabsList,
                params.type.replace(".html", ""),
                "pathName"
            );
        }
        data.page = parseInt(params.page.replace(".html", ""));

        data.jsonld[
            "@id"
        ] += `${params.type}/${params.indexTwo}/${params.page}`;
        if (params.indexTwo) {
            data.tabsTwoIndex = parseInt(params.indexTwo);
        } else data.tabsTwoIndex = 0;

        const res = await getNormAllclass({});
        if (res.code == 1) {
            let list = data.tabsList;
            for (let i = 1; i < list.length; i++) {
                list[i].class = res.data[i + ""].twoclass;
            }
            data.tabsList = list;
        }
        let parems = {
            page: data.page,
            pagesize: data.pageSize,
            id: data.tabsList[data.tabsIndex].class[data.tabsTwoIndex].id,
        };
        const res2 = await getNormGetList(parems);
        if (res2.code == 1) {
            data.dataList = res2.data;
            if (res2.data.length > 0) {
                data.total = res2.data[0].datacount;
                data.jsonld.pubDate = data.jsonld.upDate = moment(
                    res2.data[0].createtime * 1000
                ).format("YYYY-MM-DD");
            } else data.total = 0;
        }

        const res3 = await recommend_norm({
            limit: 20,
        });
        if (res3.code == 1) {
            data.readingList = res3.data;
            data.hotReadList = res3.data.slice(0, 10);
        }

        return data;
    },

    head() {
        return {
            script: [
                {
                    type: "application/ld+json",
                    innerHTML: JSON.stringify(this.jsonld), // <- set jsonld object in data or wherever you want
                },
            ],
            __dangerouslyDisableSanitizers: ["script"],
            title: this.metaTitle + "【小竹财税平台】",
            meta: [
                {
                    hid: "keywords",
                    name: "keywords",
                    content: this.metaKeywords,
                },
                {
                    hid: "description",
                    name: "description",
                    content: this.metaDescription,
                },
            ],
        };
    },
    layout: "home",
    components: {
        breadcrumb,
        statute,
        recommendedReading,
        introduceModule,
        hotRead,
        dynamicPopUps,
    },
    data() {
        return {
            metaTitle: "小竹会计法规库",
            metaKeywords: "小竹会计法规库,会计法规库",
            metaDescription:
                "小竹会计法规库汇集最新的会计法规政策及地方性会计法规政策，时时更新会计法规动态，方便会计从业者能得到更多的会计法规查询",
            getText: getText,
            // tabsList: [
            //     {
            //         name: "首页",
            //         id: "86",
            //         pathName: "index",
            //         code: "PE1",
            //         class: [
            //             {
            //                 id: 86,
            //             },
            //         ],
            //     },
            //     {
            //         id: 1,
            //         name: "企业会计",
            //         sort: "99",
            //         pathName: "qykj",
            //         code: "PE3",
            //         class: [],
            //     },
            //     {
            //         id: 2,
            //         name: "证监会",
            //         sort: "0",
            //         pathName: "zjh",
            //         code: "PE4",
            //         class: [],
            //     },
            //     {
            //         id: 3,
            //         name: "政府会计",
            //         sort: "98",
            //         pathName: "zfkj",
            //         code: "PE5",
            //         class: [],
            //     },
            //     {
            //         id: 4,
            //         name: "国际会计",
            //         sort: "0",
            //         pathName: "gjkj",
            //         code: "PE6",
            //         class: [],
            //     },
            //     {
            //         id: 5,
            //         name: "企业内控",
            //         sort: "96",
            //         pathName: "qynk",
            //         code: "PE7",
            //         class: [],
            //     },
            //     {
            //         id: 6,
            //         name: "全行业会计核算",
            //         sort: "97",
            //         pathName: "qhykjhs",
            //         code: "PE8",
            //         class: [],
            //     },
            //     {
            //         id: 7,
            //         name: "其他会计法规",
            //         sort: "0",
            //         pathName: "qtkjfg",
            //         code: "PE9",
            //         class: [],
            //     },
            //     {
            //         id: 8,
            //         name: "全科目核算",
            //         sort: "96.5",
            //         pathName: "qkmhs",
            //         code: "PE10",
            //         class: [],
            //     },
            // ],
            // tabsIndex: 0,
            // tabsTwoIndex: 0,

            linkList: [
                {
                    name: "地方注协",
                },
                {
                    name: "相关部门",
                },
            ],
            linkIndex: 0,
            chinatax: CICPA,
            customs: rd,

            // 税种
            policyCate: [],
            // 效力注释
            xiaoliList: [
                {
                    id: "现行有效",
                    name: "现行有效",
                },
                {
                    id: "部分失效/废止",
                    name: "部分失效/废止",
                },
                {
                    id: "全文失效/废止",
                    name: "全文失效/废止",
                },
                {
                    id: "已修订",
                    name: "已修订",
                },
            ],

            swiper: [],

            // 法规数据列表
            // dataList: [],
            // total: 0,
            // pageSize: 30,
            // page: 1,

            // 搜索
            keyword: "", // 标题关键字

            // 搜索2
            searchInput: "",
            number2: "",
            number3: "",
            date: "",
            retrieveFields: "name",
            pickerOptions: {
                shortcuts: [
                    {
                        text: "一个月内",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 30
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "三个月内",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 90
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                    {
                        text: "一年内",
                        onClick(picker) {
                            const end = new Date();
                            const start = new Date();
                            start.setTime(
                                start.getTime() - 3600 * 1000 * 24 * 365
                            );
                            picker.$emit("pick", [start, end]);
                        },
                    },
                ],
            },

            regionProps: {
                label: "name",
                value: "id",
                children: "children",
            }, // 地区级联选择器配置
            hotIcon: hotIcon,
            region: [],

            loading: false,
            isSearch: false,
            introduce: {
                src: "https://xzcs-video.oss-cn-beijing.aliyuncs.com/pc/fgk-describe-bj1.png",
                // title: "小竹会计法规库",
                txt: introduceJson["kjfgk"],
            },
            // hotReadList: [], //热门阅读列表
            // readingList: [], //推荐阅读列表

            searchBj: searchBj,
            searchInput: "",
        };
    },
    computed: {
        ...mapState("regulations", {
            // tabsList: (state) => state.ATabsList,
            // ADataList: (state) => state.ADataList,
            // hotReadList: (state) => state.AhotReadList,
            // readingList: (state) => state.AreadingList,
        }),
        ...mapState("common", {
            userInfo: (state) => state.userInfo,
        }),
        introduce1: function () {
            return {
                src: "https://xzcs-video.oss-cn-beijing.aliyuncs.com/pc/fgk-describe-bj.png",
                title: "",
                txt: introduceJson[
                    "kjfgk" +
                        (this.$route.params.type ? this.$route.params.type : "")
                ],
            };
        },
    },
    created() {
        this.getMetaInfo();
        this.jsonld.title = this.metaTitle;
        this.jsonld.description = this.metaDescription;
    },
    mounted() {
        for (let item of this.tabsList) {
            if (item.pathName == this.$route.params.type) {
                getanalysedata({
                    m_id: 3,
                    type: 1,
                    code: item.code,
                    describe: item.name,
                });
            }
        }
        this.setmenuIndex("2");
        // this.getNormAllclass();

        if (this.$route.params.page)
            this.page = parseInt(this.$route.params.page.replace(".html", ""));

        this.$nextTick(() => {
            goTopSmooth();
        });
    },
    watch: {
        // $route(to, from) {
        //     try {
        //         if (window) {
        //             if (to.query.index) {
        //                 this.tabsIndex = parseInt(to.query.index);
        //             }
        //             if (to.params.indexTwo) {
        //                 this.tabsTwoIndex = parseInt(to.params.indexTwo);
        //             } else this.tabsTwoIndex = 0;
        //             if (to.params.type) {
        //                 this.tabsIndex = getArr_objKey(
        //                     this.tabsList,
        //                     to.params.type.replace(".html", ""),
        //                     "pathName"
        //                 );
        //             }
        //             if (to.params.page)
        //                 this.page = parseInt(
        //                     to.params.page.replace(".html", "")
        //                 );
        //             this.getMetaInfo();
        //             this.getList();
        //         }
        //     } catch (error) {}
        // },
    },
    activated() {
        // if (this.$route.query.index) {
        //     this.tabsIndex = parseInt(this.$route.query.index)
        // }
        // if (this.dataList.length == 0) this.getList();
    },
    methods: {
        ...mapMutations("common", ["setmenuIndex", "set_payVipShow"]),

        async getList() {
            this.isSearch = false;
            this.loading = true;
            let parems = {
                page: this.page,
                pagesize: this.pageSize,
                id: this.tabsList[this.tabsIndex].class[this.tabsTwoIndex].id,
            };

            const res = await getNormGetList(parems);
            this.loading = false;

            if (res.code == 1) {
                this.dataList = res.data;
                goTop(50);
                if (res.data.length > 0) this.total = res.data[0].datacount;
                else this.total = 0;

                this.getHotRead();
            }
        },

        getMetaInfo() {
            if (this.$route.params.type == "index") {
                this.metaTitle = "小竹会计法规库";
                this.metaKeywords = "小竹会计法规库,会计法规库";
                this.metaDescription =
                    "小竹会计法规库汇集最新的会计法规政策及地方性会计法规政策，时时更新会计法规动态，方便会计从业者能得到更多的会计法规查询。";
            } else if (this.$route.params.type == "qykj") {
                this.metaTitle = "企业会计法规-会计法规库";
                this.metaKeywords = "企业会计法规";
                this.metaDescription =
                    "小竹财税企业会计法规版块，汇集众多企业会计法规。实时更新企业会计法规条例及相关企业会计法规政策出台，并积极推动企业会计法规宣传与发布。";
            } else if (this.$route.params.type == "zjh") {
                this.metaTitle = "证监会法规-会计法规库";
                this.metaKeywords = "证监会法规";
                this.metaDescription =
                    "小竹财税证监会法规版块，汇集众多证监会法规，实时更新证监会法规条例及相关证监会法规政策出台，并积极推动证监会法规宣传与发布。";
            } else if (this.$route.params.type == "zfkj") {
                this.metaTitle = "政府会计法规-会计法规库";
                this.metaKeywords = "政府会计法规";
                this.metaDescription =
                    "小竹财税政府会计法规版块，汇集众多政府会计法规，实时更新政府会计法规条例及相关证政府会计法规政策出台，并积极推动政府会计法规宣传与发布。";
            } else if (this.$route.params.type == "gjkj") {
                this.metaTitle = "国际会计法规-会计法规库";
                this.metaKeywords = "国际会计法规";
                this.metaDescription =
                    "小竹财税国际会计法规版块，汇集众多国际会计法规，实时更新国际会计法规条例及相关国际会计法规政策出台，并积极推动国际会计法规宣传与发布。";
            } else if (this.$route.params.type == "qynk") {
                this.metaTitle = "企业会计内控法规-会计法规库";
                this.metaKeywords = "企业会计内控法规";
                this.metaDescription =
                    "小竹财税企业会计内控法规版块，汇集众多企业会计内控法规，实时更新企业会计内控法规条例及相关企业会计内控法规政策出台，并积极推动企业会计内控法规宣传与发布。";
            } else if (this.$route.params.type == "qhykjhs") {
                this.metaTitle = "全行业会计核算-会计法规库";
                this.metaKeywords = "全行业会计核算";
                this.metaDescription =
                    "小竹财税全行业会计核算版块，汇集众多全行业会计核算案例，实时更新全行业会计核算资讯及相关全行业会计核算法规政策出台，并积极推动全行业会计核算宣传与发布。";
            } else if (this.$route.params.type == "qtkjfg") {
                this.metaTitle = "会计法规条例-会计法规库";
                this.metaKeywords = "会计法规条例";
                this.metaDescription =
                    "小竹财税会计法规条例版块，汇集众多会计法规条例，实时更新会计法规条例及相关会计法规条例政策出台，并积极推动会计法规条例宣传与发布。";
            } else if (this.$route.params.type == "qkmhs") {
                this.metaTitle = "全科目会计核算-会计法规库";
                this.metaKeywords = "全科目会计核算";
                this.metaDescription =
                    "小竹财税全科目会计核算版块，汇集众多全科目会计核算案例，实时更新全科目会计核算资讯及相关全科目会计核算法规政策出台，并积极推动全科目会计核算法规宣传与发布。";
            }
        },

        // 获取会计法规库类目
        async getNormAllclass() {
            const res = await getNormAllclass({});
            if (res.code == 1) {
                let list = this.tabsList;
                for (let i = 1; i < list.length; i++) {
                    list[i].class = res.data[i + ""].twoclass;
                }
                this.tabsList = list;
                this.getList();
            }
        },

        async getLunbo() {
            const res = await faguislideshow({
                type: 3, // 会计 3   税收 4
            });
            if (res.code == 1) {
                this.swiper = res.data;
            }
        },

        // 获取推荐阅读
        async getreadingList() {
            if (this.readingList.length > 0) return;
            const res2 = await recommend_norm({
                limit: 20,
            });
            if (res2.code == 1) {
                this.readingList = res2.data;
            }
        },

        // 获取热门阅读
        async getHotRead() {
            if (this.hotReadList.length > 0) return;
            if (this.tabsIndex != 0) {
                this.getreadingList();
                return;
            }
            const res2 = await recommend_norm({
                limit: 10,
            });
            if (res2.code == 1) {
                this.hotReadList = res2.data;
                this.getreadingList();
            }
        },

        startSearch() {
            if (!this.userInfo) {
                this.$router.push({
                    path: "/login",
                    query: {
                        url: window.location.pathname + window.location.search,
                    },
                });
                return;
            }
            this.page = 1;
            this.search();
        },

        // 搜索
        async search() {
            this.isSearch = true;
            this.loading = true;
            let parems = {
                page: this.page,
                limit: this.pageSize,
                // ctype: this.tabsList[this.tabsIndex].class[this.tabsTwoIndex]
                //     .id,
                // keyword: this.keyword.replace(/\s*/g, ""),
                keyword: this.keyword,
            };

            const res = await getNormSearch(parems);
            this.loading = false;
            if (res.code == 1) {
                this.dataList = res.data;
                goTop(50);
                if (res.data.length > 0) this.total = res.data[0].datacount;
                else this.total = 0;
            }
        },

        // 清空搜索
        clear() {
            // this.title_keyword = ''
            // this.cons_keyword = ''
            // this.zh_keyword = ''
            this.city_code = "";
            this.policy_cate_id = "";
            this.xiaoli_id = "";
            this.date_ = "";
        },

        // 切换分页
        changePage(page) {
            this.page = page;
            if (this.isSearch) this.search();
            else {
                this.$router.push({
                    name: "kjfgk-type-indexTwo-page",
                    // query: {
                    //     indexTwo: this.tabsTwoIndex,
                    // },
                    params: {
                        type: this.tabsList[this.tabsIndex].pathName,
                        page: page + "",
                        indexTwo: this.tabsTwoIndex,
                    },
                });
            }
        },

        // 点击menu
        menuSelect(index) {
            let tabsIndex = Math.trunc(index.slice(0, 1));
            let tabsTwoIndex = parseInt(index.slice(1));
            if (
                this.tabsIndex == tabsIndex &&
                this.tabsTwoIndex == tabsTwoIndex
            )
                return;
            // this.tabsIndex = tabsIndex;
            // this.tabsTwoIndex = tabsTwoIndex;
            // this.page = 1;
            this.$router.push({
                name: "kjfgk-type-indexTwo-page",
                // query: {
                // },
                params: {
                    type: this.tabsList[tabsIndex].pathName,
                    page: "1",
                    indexTwo: tabsTwoIndex,
                },
            });
            // this.getList();
        },

        // 选中城市
        cityChange(e) {
            console.log(this.city_code);
        },

        goLink(item) {
            window.open(item.link);
        },

        // 前往详情页
        async goDetails(item) {
            // const res = await checkviewNorm({
            //     id: item.id,
            // });
            // if (res.code == -100) {
            //     return;
            // }
            let routeData = this.$router.resolve({
                name: "AccountingDetails",
                params: {
                    id: item.id + "",
                },
                query: {
                    index: this.tabsIndex,
                    indexTwo: this.tabsTwoIndex,
                },
            });
            window.open(routeData.href, "_blank");
            // console.log(item)
            // this.$router.push({
            //     path: 'TaxRevenue/Details',
            //     query: {
            //         id: item.id,
            //         index: this.tabsIndex
            //     }
            // })
        },

        keydown(e) {
            if (!e.shiftKey && e.keyCode == 13) {
                e.cancelBubble = true; //ie阻止冒泡行为
                e.stopPropagation(); //Firefox阻止冒泡行为
                e.preventDefault(); //取消事件的默认动作*换行
                //以下处理发送消息代码
                if (e.keyCode == 13) {
                    this.allSearch();
                }
            }
        },

        goViponly() {
            if (!this.userInfo) {
                this.$confirm("该功能需要登录后使用", "提示", {
                    confirmButtonText: "去登录",
                    cancelButtonText: "再看看",
                })
                    .then(() => {
                        this.$router.push({
                            path: "/login",
                            query: {
                                url:
                                    window.location.pathname +
                                    window.location.search,
                            },
                        });
                    })
                    .catch(() => {});
                return;
            }

            if (this.userInfo.is_gpt_vip == 0) {
                this.$confirm("该功能仅限会员用户使用", "提示", {
                    confirmButtonText: "成为会员",
                    cancelButtonText: "再看看",
                })
                    .then(() => {
                        this.set_payVipShow(true);
                    })
                    .catch(() => {});
                return;
            }

            this.$router.push({
                path: "/viponly",
            });
        },

        allSearch() {
            if (!this.userInfo) {
                this.$confirm("该功能需要登录后使用", "提示", {
                    confirmButtonText: "去登录",
                    cancelButtonText: "再看看",
                })
                    .then(() => {
                        this.$router.push({
                            path: "/login",
                            query: {
                                url:
                                    window.location.pathname +
                                    window.location.search,
                            },
                        });
                    })
                    .catch(() => {});
                return;
            }

            if (
                (this.retrieveFields == "name" ||
                    this.retrieveFields == "info_content_text") &&
                !this.searchInput
            ) {
                this.$message({
                    message: "请输入搜索内容",
                    type: "warning",
                });
                return;
            }
            if (this.retrieveFields == "push_date" && !this.date) {
                this.$message({
                    message: "请输入搜索内容",
                    type: "warning",
                });
                return;
            }
            if (this.retrieveFields == "push_number" && !this.searchInput) {
                this.$message({
                    message: "请输入搜索内容",
                    type: "warning",
                });
                return;
            }

            this.$router.push({
                path: "/kjfgksearch",
                query: {
                    k: this.searchInput,

                    date: this.date.length > 0 ? this.date.join(",") : "",
                    t: this.retrieveFields,
                },
            });
        },

        goLunbo(url) {
            this.$router.push({
                path: url,
            });
        },

        command(e) {
            this.retrieveFields = e;
        },
    },
};
</script>

<style lang="scss" scoped>
.tabs-top {
    position: sticky;
    top: 80px;
    left: 0;
    height: 50px;
    background: #1c87f3;
    display: flex;
    z-index: 997;
    // width: 1200px;
    // margin: 0 auto;
    justify-content: center;

    .tab {
        line-height: 50px;
        font-size: 14px;
        color: #ffffff;
        padding: 0 34px;
        cursor: pointer;
        user-select: none;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;

        &:hover {
            background: #1976d4;
        }
    }

    .tabs-active {
        background: #1976d4;
    }
}

.big-search {
    height: 140px;
    width: 100%;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;

    .high-search {
        font-size: 16px;
        color: #ffffff;
        line-height: 20px;
        transition: width 0.3s;
        overflow: hidden;
        white-space: pre;
        cursor: pointer;
        box-sizing: border-box;
        text-align: right;

        div {
            padding-left: 25px;
        }
    }
}

.big-search-div {
    display: flex;
    align-items: center;
    height: 55px;
    background-color: #ffffff;

    .left {
        text-align: center;
        width: 105px;
        height: 55px;
        line-height: 55px;
        cursor: pointer;
        user-select: none;
    }
    .kuohao {
        padding: 0 10px;
    }
    .search-input {
        border: none;
        width: 505px;

        &::v-deep .el-input__inner {
            border: none;
            // border-left: 1px solid #dfdfdf;
            border-radius: 0;
            font-size: 16px;
            // height: 26px;
            // list-style: 26px;
        }
    }

    .search-button {
        cursor: pointer;
        width: 133px;
        height: 55px;
        background: #004895;
        font-size: 16px;
        color: #ffffff;
        text-align: center;
        line-height: 55px;

        i {
            font-size: 18px;
        }

        &:active {
            opacity: 0.8;
        }
    }
}

.big-search-sbvip {
    display: block;
    height: 40px;
    line-height: 40px;
    background-color: #1c87f3;
    color: #ffffff;
    font-size: 18px;
    padding: 0 10px;
    border-radius: 6px;
    margin-left: 20px;
    cursor: pointer;
    user-select: none;
    position: relative;
    div {
        background-color: #ff1111;
        color: #ffffff;
        font-weight: 400;
        font-size: 10px;
        position: absolute;
        right: -25px;
        top: -6px;
        height: 16px;
        line-height: 14px;
        width: 50px;
        border-radius: 16px;
        text-align: center;
    }
    &:hover {
        opacity: 0.8;
    }
    &:active {
        opacity: 0.9;
    }
}

.index {
    width: 1200px;
    margin: 0 auto;
    margin-top: 22px;
    margin-bottom: 44px;
    display: flex;

    .left {
        width: 383px;

        .introduce {
            width: 383px;
            height: 218px;
        }

        .swiper {
            width: 383px;
        }

        .link {
            margin-top: 14px;
            background-color: #ffffff;
            position: sticky;
            top: 153px;
            .hot_read {
                top: 486px;
            }
        }

        .introduce-index {
            // position: sticky;
            // top: 153px;
        }

        .list {
            padding: 21px;
            padding-right: 0;
        }

        .item2 {
            display: inline-block;
            margin: 6px 0;
            font-size: 14px;
            color: #666666;

            &:hover {
                cursor: pointer;
                color: #1c87f3;
            }
        }

        .item {
            display: inline-block;
            width: 71px;
            margin: 6px 0;
            font-size: 14px;
            color: #666666;

            &:hover {
                // text-decoration: underline;
                cursor: pointer;
                color: #1c87f3;
            }
        }
    }

    .right {
        width: 100%;
        margin-left: 14px;

        .right_top {
            background-color: #ffffff;
        }

        .right_bottom {
            margin-top: 20px;
        }

        .title {
            border-bottom: 1px solid #f1f1f1;
            height: 69px;
            display: flex;
            align-items: center;
            padding-left: 41px;
            font-size: 20px;
            font-weight: 500;
            color: #333333;

            .icon {
                width: 15px;
                height: 17px;
                margin-right: 7px;
            }
        }

        .list {
            padding-left: 28px;
            padding-right: 35px;
        }

        .item {
            display: block;
            padding: 20px 0;
            border-bottom: 1px solid #f4f4f4;
            color: #333333;

            // a {
            // display: flex;
            // align-items: center;
            // justify-content: space-between;

            // }

            .name {
                width: 640px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                font-size: 16px;
                font-weight: 800;
                color: #000000;
                line-height: 50px;
                display: block;
                &:hover {
                    color: #1c87f3;
                    text-decoration: underline;
                }
            }

            .introduce_txt {
                // margin-top: 20px;
                font-size: 14px;
                font-weight: 400;
                color: #666666;
                line-height: 20px;
                overflow: hidden;
                // white-space: nowrap;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                /* 这里设置的是文本的最大行数 */
                -webkit-box-orient: vertical;
                width: 735px;
                height: 40px;

                &::v-deep p {
                    line-height: 20px !important;
                    white-space: break-spaces;
                }

                &::v-deep span {
                    line-height: 20px !important;
                    white-space: break-spaces;
                }

                &::v-deep a {
                    line-height: 20px !important;
                    white-space: break-spaces;
                }

                &::v-deep img {
                    display: none;
                }
            }

            .date {
                padding-top: 10px;
                font-size: 13px;
                color: #999999;
            }
        }
    }
}

.regulation-con {
    display: flex;
    justify-content: space-between;
    width: 1200px;
    margin: 30px auto;
    align-items: flex-start;

    .left {
        position: sticky;
        top: -271px;
        left: 0;
        width: 254px;

        .left_bottom {
            position: sticky;
            top: 135px;
            left: 0;
        }

        i {
            color: #ffffff;
        }
    }

    .right {
        width: 925px;
        // padding: 34px;
        box-sizing: border-box;

        .right_top {
            background: #ffffff;
        }

        .right_bottom {
            margin-top: 20px;
        }

        .search2 {
            justify-content: center !important;

            .search-item2 {
                .input {
                    width: 245px;
                }

                .label {
                    width: 110px;
                    text-align: right;
                }
            }
        }

        .search {
            padding: 34px;
            padding-bottom: 0;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;

            .search-item {
                display: flex;
                align-items: center;
                font-size: 14px;
                color: #333333;
                // margin-bottom: 22px;
            }

            .input {
                margin-left: 10px;
                margin-right: 16px;
                width: 680px;
            }

            .date-picker {
                margin-left: 10px;
                margin-right: 260px;
            }
        }

        .search-but {
            text-align: center;
            // padding-top: 10px;
        }

        .r-title {
            display: inline-block;
            padding: 0 34px;
            font-size: 16px;
            font-weight: 700;
            color: #333333;
            padding-top: 32px;
            padding-bottom: 20px;

            // display: flex;
            // align-items: center;
            div {
                height: 8px;
                width: 110%;
                position: relative;
                left: -5%;
                top: -6px;
                background-color: #1c87f3;
                opacity: 0.4;
            }
        }
    }
}

.new-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px #e9e9e9 solid;
    padding: 15px 26px;

    .title {
        font-size: 20px;
        font-weight: 700;
    }

    .new-switch {
        display: flex;
        border-radius: 4px;
        border: 1px solid #d9d9d9;
        height: 28px;
        line-height: 28px;
        overflow: hidden;

        .new-tab {
            padding: 0 10px;
            font-size: 14px;
            cursor: pointer;
            color: #333333;
        }

        .new-tab-active {
            background-color: #1c87f3;
            color: #ffffff;
        }

        .new-tab:nth-child(1) {
            border-right: 1px solid #d9d9d9;
        }
    }
}

.breadcrumb-item {
    cursor: pointer;
    font-weight: 700;
    transition: color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    color: #303133;

    &:hover {
        color: #409eff;
    }
}

.wx-code {
    margin-top: 15px;
    width: 383px;
    img {
        width: 383px;
        height: auto;
    }
}
.wx-code2 {
    margin: 8px 0;
    width: 254px;
    img {
        width: 254px;
        height: auto;
    }
}

::v-deep .el-submenu:not(:last-child) {
    border-bottom: 2px solid #f0f0f2;
}

::v-deep .tabs {
    border-bottom: 1px #e9e9e9 solid;
    width: auto !important;
    padding-top: 0 !important;
}

::v-deep .tabs .tab {
    width: 50% !important;
    text-align: center !important;
    margin: 0 !important;
    height: 60px !important;
    line-height: 60px !important;
}

::v-deep .el-submenu__title {
    background-color: #1c87f3;
    color: #ffffff;
}

::v-deep .el-submenu__title:hover {
    background-color: rgba($color: #1c87f3, $alpha: 0.8);
}

::v-deep .el-menu-item.is-active {
    background-color: #f2f8ff;
}

::v-deep .el-submenu__title i {
    color: #ffffff;
}

::v-deep .el-submenu__title i::before {
    content: "\e6d9";
}

::v-deep .el-submenu.is-opened > .el-submenu__title .el-submenu__icon-arrow {
    transform: rotateZ(0) !important;
}

::v-deep
    .el-submenu.is-opened
    > .el-submenu__title
    .el-submenu__icon-arrow::before {
    content: "\e7a9";
}

.introduce1 {
    width: 254px;
    height: 236px;
    margin-bottom: 20px;
}
::v-deep .el-date-editor .el-range__icon {
    color: #1c87f3;
}

.padding-l30 {
    padding-left: 30px;
    a {
        width: 100%;
        margin: 8px 0;
    }
}

.pagination {
    text-align: center;
    padding: 20px 0;
}
</style>